package com.definity.toolkit.web.taglib;

import javax.servlet.jsp.JspException;

public class UploadTag extends BaseTag {

	private static final long serialVersionUID = -7445973281679847036L;

	
	private String action;
	
	public UploadTag() {
		
	}
	
	public void setAction(String action) {
		this.action = action;
	}
	
	public String getAction() {
		return action;
	}
	
	@Override
	public int doEndTag() throws JspException {
		StringBuilder html = new StringBuilder();
		
		html.append("\n<form action=\"" + action + "\"");
		html.append(" method=\"post\"");
		html.append(" enctype=\"multipart/form-data\"");
		html.append(createStyleClass());
		html.append(">");
		html.append("<div class=\"content\">");
		html.append("<input type=\"file\" id=\"file\" name=\"arquivo\" class=\"xlarge\"/>");
		html.append("</div>");
		html.append("<div class=\"button\">");
		html.append("<button class=\"default\">" + i18n().tl("button.send") + "</button>");
		html.append("</div>");
		html.append("</form>\n");
		
		write(html);
		
		return super.doEndTag();
	}
	
	
}
